From: Benjamin Otte Date: Wed, 26 Apr 2023 23:27:50 +0000 (+0200) Subject: win32: Actually increase the counter X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~59^2^2~291^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c37786af360ac1e2b205bff6d84bf47a64253d54;p=gtk4.git win32: Actually increase the counter We were sending random junk to ChoosePixelFormat(). Also assert that we don't overflow the array. That might be usefu to know if we carelessly add attributes later. --- diff --git a/gdk/win32/gdkglcontext-win32-wgl.c b/gdk/win32/gdkglcontext-win32-wgl.c index cc3c3097a9..c6cdbfb533 100644 --- a/gdk/win32/gdkglcontext-win32-wgl.c +++ b/gdk/win32/gdkglcontext-win32-wgl.c @@ -153,7 +153,7 @@ get_wgl_pfd (HDC hdc, HGLRC hglrc_current = wglGetCurrentContext (); /* Update PIXEL_ATTRIBUTES above if any groups are added here! */ - pixelAttribs[i] = WGL_DRAW_TO_WINDOW_ARB; + pixelAttribs[i++] = WGL_DRAW_TO_WINDOW_ARB; pixelAttribs[i++] = GL_TRUE; pixelAttribs[i++] = WGL_SUPPORT_OPENGL_ARB; @@ -183,6 +183,7 @@ get_wgl_pfd (HDC hdc, } pixelAttribs[i++] = 0; /* end of pixelAttribs */ + g_assert (i <= PIXEL_ATTRIBUTES); best_pf = gdk_init_dummy_wgl_context (display_win32); if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc, @@ -196,8 +197,8 @@ get_wgl_pfd (HDC hdc, pixelAttribs, NULL, 1, - &best_pf, - &num_formats); + &best_pf, + &num_formats); /* Go back to the HDC that we were using, since we are done with the dummy HDC and GL Context */ wglMakeCurrent (hdc_current, hglrc_current);